 <?php
 session_start();
 include_once ("Login/databaseconnection.php");
 $current_table="deleted_resource_team";
 date_default_timezone_set("Europe/Paris");
  	$t_d=date("Y/m/d");
	$T_NIC_Number=$_GET['T_NIC_Number'];
	$Training_Id=$_GET['Training_Id'];
	$sqlre=mysql_query("SELECT * FROM deleted_resource_team");
	if(mysql_num_rows($sqlre)!=0)
	{
		$Training_Id=$_POST['Training_Id'];
		$T_NIC_Number=$_POST['T_NIC_Number'];
		$Member_Id=$_POST['Member_Id'];
		$From_Date=$_POST['From_Date'];
		$Last_Updated_Date=$_POST['Last_Updated_Date'];
		$Accessed_By=$_POST['Accessed_By'];
		$_SESSION['Accessed_By']=$Accessed_By;
	$sql=mysql_query("INSERT INTO  resource_team(Training_Id,T_NIC_Number,Member_Id,From_Date,Last_Updated_Date)VALUES('$Training_Id','$T_NIC_Number','$Member_Id','$From_Date','$t_d')");
if($sql)
{  $resultdel=mysql_query("DELETE FROM deleted_resource_team WHERE T_NIC_Number='$T_NIC_Number' AND Training_Id='$Training_Id'");
  if(!$resultdel)
{
	$sql=mysql_query("INSERT INTO  resource_team(Training_Id,T_NIC_Number,Member_Id,From_Date,Last_Updated_Date)VALUES('$Training_Id','$T_NIC_Number','$Member_Id','$From_Date','$t_d')");
	 $_SESSION['error']="but this record is not removed from the recycle bin!";
}
$_SESSION['error']="Successfully restored!";
}
   if(!$sql)
{
	 $_SESSION['error']="Sorry,an error occured  please try again!";
}	
}
?>
